<?php
/**
 * @version		$Id: default.php 25 2010-09-08 15:16:11Z joomlaworks $
 * @package		K2mart
 * @author    JoomlaWorks http://www.joomlaworks.gr
 * @copyright	Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
 * @license		Commercial - This code cannot be redistributed without permission from Nuevvo Webware Ltd.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<script type="text/javascript">
	//<![CDATA[
	window.addEvent('domready', function(){
		$('toolbar-Link').addEvent('click', function(e){
			new Event(e).stop();
			if($('categoryName').getProperty('value').trim()=="" && $('catid').getProperty('value')=='0'){
				alert('<?php echo JText::_('Please type a category name');?>');
				return false;
			}
			var answer = confirm('<?php echo JText::_('WARNING: You are about to import all categories and products from Virtuemart into K2! If your site has more than a few thousand products, the process may take a few minutes. If you have executed this operation before, duplicate content may be produced!', true); ?>');
			if (answer){
				submitbutton('import');
				$E('.k2martMigratorLoader').setStyle('display', 'inline');
			}
		});
		$('catid').addEvent('change', function(e){
			if(this.getProperty('value')=='0'){
				new Fx.Style($('categoryName'), 'opacity', {
					duration: 1000
				}).start(1);
			}
			else {
				new Fx.Style($('categoryName'), 'opacity', {
					duration: 1000
				}).start(0);
			}
		});
	});
	//]]>
</script>
<div class="k2martMigratorLoader"><?php echo JText::_('Please wait');?><br/><?php echo JText::_('This may take several minutes');?></div>
<div class="k2martMigrator">
	<form action="index.php" method="post" name="adminForm">
		<fieldset>
			<legend><?php echo JText::_('Import settings');?></legend>
			<div class="k2martMigratorField">
				<label for="catid"><?php echo JText::_('Catalog root category');?></label>
				<?php echo $this->lists['category']; ?> <input type="text" name="categoryName" id="categoryName" size="50" />
				<span class="k2martNote"><?php echo JText::_('All imported categories from Virtuemart will be placed under this category and they will inherit it\'s settings. Select one of the existing K2 categories or type a category name and let K2mart create this category for you using the default category settings')?></span>
			</div>
			<div class="k2martMigratorField">
				<label for="ignoreUnpublished"><?php echo JText::_('Ignore unpublished Virtuemart products and categories');?></label>
				<input type="checkbox" value="1" name="ignoreUnpublished" id="ignoreUnpublished" />
				<span class="k2martNote"><?php echo JText::_('If you check this the migrator will not import Virtuemart unpublished products and categories');?></span>
			</div>
			<div class="k2martMigratorField">
				<label for="proccessImages"><?php echo JText::_('Process product images');?></label>
				<input type="checkbox" value="1" checked="checked" name="proccessImages" id="proccessImages" />
				<span class="k2martNote"><?php echo JText::_('Uncheck this if you want the migrator to not import the product images into the K2 items');?></span>
			</div>
			<input type="hidden" name="option" value="com_k2mart" /> 
			<input type="hidden" name="view" value="migrator" /> 
			<input type="hidden" name="task" value="import" />
			<?php echo JHTML::_('form.token'); ?>
		</fieldset>
	</form>
</div>

<div id="k2martAdminFooter">
	<?php echo JText::_('K2MART_COPYRIGHTS'); ?>
</div>
